home *** CD-ROM | disk | FTP | other *** search
- Path: newsfeed.ksu.ksu.edu!usenet
- From: Iyer <iyer@ksu.ksu.edu>
- Newsgroups: comp.lang.c++
- Subject: (no subject)
- Date: 3 Apr 1996 23:00:36 GMT
- Organization: Kansas State University
- Message-ID: <4juvuk$4vn@newserv.ksu.ksu.edu>
- NNTP-Posting-Host: 129.130.81.118
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
-
- I have a problem in returning a two dimensional array.I have declared it
- as a two dimensional pointer in my Matrix class.This is a private
- variable.To access this i have two functions .One is
- void SetMatrixElements(double **mat)
- double **GetMatElements();
- When i receive this GetMatElements(),i am declaring a double **temp,
- then I am receiving in this temp pointer.But i am not allocating any
- memory for this temp pointer.When i delete the the Matrix object, it's
- mat elements get deleted,but to which this temp is pointing.But i cannot
- delete the temp before i quit the function,this will delete the mat
- elements.So, what shall i do.
-
- class Matrix
- {
- private:
- int nc;int nr; double **mat;
- public:
- double **GetMatElemnts();
- void SetMatElemnts(double **m);
-
- }
-
-
- Matrix *A;
- void Function(){
- double **temp;
- temp = A->GetMatElements();
-
-
-
- }
-
-
-
-
-